
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using TagCloud;

namespace Wp.DAL
{
    public partial class TblTermTaxonomyEntity
    {
        public string Slug { get; set; }
        public string Name { get; set; }

        public TblTermTaxonomyEntity GetTblTermTaxonomyEntity(DataRow dr)
        {
            TblTermTaxonomyEntity item = new TblTermTaxonomyEntity();
            if (dr.Table.Columns.Contains("Id"))
                item.Id = dr["Id"].ToInt();
            if (dr.Table.Columns.Contains("TermId"))
                item.TermId = dr["TermId"].ToInt();
            if (dr.Table.Columns.Contains("Taxonomy"))
                item.Taxonomy = dr["Taxonomy"].ToString();
            if (dr.Table.Columns.Contains("Description"))
                item.Description = dr["Description"].ToString();
            if (dr.Table.Columns.Contains("ParentId"))
                item.ParentId = dr["ParentId"].ToInt();
            if (dr.Table.Columns.Contains("Count"))
                item.Count = dr["Count"].ToInt();
            if (dr.Table.Columns.Contains("Name"))
                item.Name = dr["Name"].ToString();
            if (dr.Table.Columns.Contains("Slug"))
                item.Slug = dr["Slug"].ToString();

            return item;
        }
        public Tag GetTagEntity(DataRow dr)
        {
            Tag item = new Tag();
            //if (dr.Table.Columns.Contains("Id"))
            //    item.Id = dr["Id"].ToInt();
            //if (dr.Table.Columns.Contains("TermId"))
            //    item.TermId = dr["TermId"].ToInt();
            //if (dr.Table.Columns.Contains("Taxonomy"))
            //    item.Taxonomy = dr["Taxonomy"].ToString();
            //if (dr.Table.Columns.Contains("Description"))
            //    item.Description = dr["Description"].ToString();
            //if (dr.Table.Columns.Contains("ParentId"))
            //    item.ParentId = dr["ParentId"].ToInt();
            if (dr.Table.Columns.Contains("Count"))
                item.TagWeight = dr["Count"].ToInt();
            if (dr.Table.Columns.Contains("Name"))
                item.Text = dr["Name"].ToString();
            if (dr.Table.Columns.Contains("Slug"))
                item.Slug = dr["Slug"].ToString();
            if (dr.Table.Columns.Contains("Slug"))
                item.NavigateUrl = "/tag/" + dr["Slug"].ToString() + ".html";

            return item;
        }
    }
}
